import io
import os

from setuptools import find_packages, setup

NAME = 'apitest'
DESCRIPTION = 'apitest dist package'
URL = 'https://code.byted.org/motor_qa/api_test_tool.git'
EMAIL = 'wangjin.shmily@bytedance.com'
AUTHOR = 'wangjin.shmily'

REQUIRES = [
    'bytedeuler==2.6.4',
    'bytedmysql==0.4.1',
    'httpx==0.24.1',
    'pytomlpp==1.0.13',
    'PyYAML==6.0.1',
    'requests-toolbelt==1.0.0',
    'sqlacodegen==2.3.0.post1',
    'thriftpy2==0.4.20',
    'thrift2pyi==1.0.5',
    'pydantic==1.10.17',
    'pytest==7.4.3'
]

DEPENDENCY_LINK = [
    'https://bytedpypi.byted.org/simple'
]

here = os.path.abspath(os.path.dirname(__file__))

try:
    with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
        long_description = '\n' + f.read()
except IOError:
    long_description = DESCRIPTION

about = {}
with io.open(os.path.join(here, NAME, '__version__.py')) as f:
    exec(f.read(), about)

# class InstallScripts(install_scripts):
#
#     def run(self):
#         install_scripts.run(self)
#
#         # Rename some script files
#         for script in self.get_outputs():
#             if script.endswith(".py") or script.endswith(".sh"):
#                 dest = script[:-3]
#             else:
#                 continue
#             print("moving %s to %s" % (script, dest))
#             shutil.move(script, dest)


setup(
    name=NAME,
    version=about['__version__'],
    description=DESCRIPTION,
    long_description=long_description,
    long_description_content_type='text/markdown',
    author=AUTHOR,
    author_email=EMAIL,
    include_package_data=True,
    url=URL,
    classifiers=[
        'Intended Audience :: Developers',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.7',
    ],
    keywords='apitest',
    packages=find_packages(exclude=['.gitignore', 'bin', "demo", "tests"]),
    install_requires=REQUIRES,
    python_requires='>=3.7',
    package_data={
        NAME: ['py.typed', '*.pyi', '*.ini', '*.yaml', '*.thrift', '*.zip', 'conf/*.yaml'],
    },
    extras_require={
        ':python_version<"3.5"': [
            'typing>=3.6.4',
        ]
    },
    entry_points={
        'console_scripts': [
            'apitest = apitest.main:main',
        ]
    },

)
